from wsgiref.validate import validator

from django import forms
from django.core import validators


#留言板的表单
class MessageBoardForm(forms.Form):
    title = forms.CharField(max_length=30, label = '标题', min_length = 2, error_messages = {"min_length": '标题最小长度不能少于2!',"max_length":'标题最大不能超过30字符！'})
    content = forms.CharField(widget=forms.Textarea, label='内容')
    email = forms.EmailField(label='邮箱')
    reply = forms.BooleanField(required=False, label='回复')


#手机号码验证器
class RegisterForm(forms.Form):
    telephone = forms.CharField(validators=[validators.RegexValidator("1[345678]\d{9}",message='请输入正确格式的手机号码!')])
